<?php
include('C:\XAMPP\xampplite\htdocs\selfPFM\lib\config.lib');

session_start();

if (isset($_REQUEST["logout"]) or (isset($_SESSION["lastActivityTime"]) && (time() - $_SESSION["lastActivityTime"]) > $sessionTimeout))
{
	$_SESSION["userType"] = 'anonym';
	unset($_SESSION["username"]);
	unset($_SESSION["userid"]);
	unset($_SESSION["familyMember"]);
	unset($_SESSION["lastActivityTime"]);
}

if (!isset($_SESSION["userType"]))
{
	$_SESSION["userType"] = "anonym";
}
else
{
	$_SESSION["lastActivityTime"] = time();
}

$conn = new dbConnection("user");

if (isset($_REQUEST["p"]))
{
/*	if (isset($pages[$_REQUEST["p"]]))
	{
		$selectedPage = $_REQUEST["p"];
	}*/
	$selectedPage = $_REQUEST["p"];
}

if (!isset($selectedPage) || $_SESSION["userType"] == "anonym")
{
	$selectedPage = 'index';
}

include($webserverRoot . 'includes/htmlhead.inc');
?>

<div id="main">

	<div id="maincontent">
<?php
include($webserverRoot . 'includes/header.inc');
?>
	<!-- left stripe-->
		<div id="left">
<?php
include($webserverRoot . 'includes/mainleft.inc');
?>
		</div>

	<!-- right stripe-->
		<div id="right">
<?php
include($webserverRoot . 'includes/' . $selectedPage . '.inc');
?>
		</div>

		<div id="clearer"></div>
	</div>
</div>

<?php
include($webserverRoot . 'includes\footer.inc');
include($webserverRoot . 'includes\htmlfoot.inc');
?>